home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
mcu332
/
332equ.arc
/
332TPU.EQU
< prev
next >
Wrap
Text File
|
1990-03-12
|
38KB
|
745 lines
****************************************************************************
* $RCSfile: 332tpu.equ $
* $Revision: 1.1 $
* $Date: 90/03/12 13:45:51 $
*
* -------------------------------------------------------------
* Module Name: 332TPU - MC68332 TPU Registers
* -------------------------------------------------------------
*
* Description:
* 1. This file contains EQUates for all the Time Processing
* Unit (TPU) registers and bits for the MC68332. Consult
* the "Time Processing Unit User's Manual", part number
* TPU32UM/AD, for more details.
* 2. A 512-byte address space is reserved for the TPU, though not
* all are used.
* 3. The ABSOLUTE address area where the register array block
* appears in memory is specified by the value of REG$, which
* should be defined in the user's system definitions. The
* value of REG$ is $YFF000, where Y = M111 and M reflects the
* modmap bit (MM) in the module configuration register (MCR).
*
* REG$ value Comments
* ---------- ---------------------------------
* $007FF000 MCR MM bit = 0
* $00FFF000 MCR MM bit = 1 (reset default)
* $FFFFF000 MCR MM bit = 1 (reset default)
* Forces short addressing (unused
* upper address lines are ignored)
* 4. The following pages summarize these registers and their
* associated addresses.
*
* Notes:
* 1. Motorola reserves the right to make changes to this file.
* Although this file has been carefully reviewed and is
* believed to be reliable, Motorola does not assume any
* liability arising out of its use. This code may be freely
* used and/or modified at no cost or obligation to the user.
* 2. All descriptions are WORD values unless stated otherwise.
* +----------------- C A U T I O N -----------------+
* | All TPU registers are 16-bits in length and are |
* | accessable as word or long-word transfers with |
* | the execption of the interrupt status register, |
* | which is also accessable on a byte basis. Thus |
* | all byte sized instructions (MOVE.B, OR.B, |
* | AND.B, etc.) and byte only instructions (BCHG, |
* | BCLR, BSET, BTST) are not allowed except on the |
* | interrupt status register (CISR). C compilers |
* | must not optimize code into illegal register |
* | access instructions! |
* +-------------------------------------------------+
* 3. The DEF macro along with the BIT$CODE symbol controls the
* actual bit definitions. See the DEF macro in the DEF.MAC
* file for details.
* 4. This file was made for use with the Motorola Development
* Systems M68000 Family Structured Assembler for MS-DOS,
* known as M68MASM.
* 5. To use this file, either use an INCLUDE statement or just
* merge this file into your source code file. Consult your
* assembler's user's manual for the details specific to your
* situation. Reference the code segment example below for
* usage ideas (shown in M68MASM for MS-DOS syntax).
*
* REG$ EQU $FFFFF000 Register base address
* * NOTE: A31-24 unused in MC68332, so we set them all =1
* * in order to use absolute short addressing mode!
* NOLIST
* INCLUDE "DEF.MAC"
* INCLUDE "332TPU.EQU"
* LIST
* START CLR.W TTCR+TPU$ Absolute addressing!
* LEA TPU$,A6 . OR
* CLR.W (TTCR,A6) Indexed addressing!
* * Bit number usage w/indexing!
* BTST #.CH3,(CISR+1,A6)
* OR.W #1<<.SUPV,(TMCR,A6)
* OR.W (1<<.STOP)+(1<<.STF),(TMCR,A6)
* * . OR
* * Bit value usage w/indexing!
* AND.W #(-_SUPV-1)&$FFFF,(TMCR,A6)
* OR.W _STOP+_STF,(TMCR,A6)
* * Bit field usage w/indexing!
* MOVE.W #(5*TINTL)+((64>>4)*TINTV),(TILR,A6)
* * Bit field mask usage w/indexing!
* MOVE.W (TILR,A6),D0
* MOVE.W D0,D1
* AND.W #TINTL_MSK,D0 Isolate ILQSPI field
* MOVE.L #.TINTL,D2 . (D2= shift count)
* LSR.W D2,D0 and right justify it!
* AND.W #TINTL_NMSK,D1 Clear ILQSPI field.
* *
* * Macro to initialize a Channel
* INIT_CH .CH15,F$DIO,DIO$INIT,DIO.MATCH,P$HIGH
* * Macro to set up Channel Function Select Registers
* SET_CF .CH10,F$SM
* * Macro to set up 2-bit Channel Fields in registers
* SET_XX .CH4,2,HSQR
* SET_XX .CH9,1,HSRR
* SET_XX .CH14,3,CPR
*
* For bit fields, a value (0-N) will be placed inside. As
* can be seen in the last line above, this is accomplished
* by multiplying the bit field label by the desired value
* for the field. This line initializes the TILR register
* which has two bit fields, TINTL_ and TINTV_. These
* fields are initialized to interrupt level 5 and interrupt
* base vector 4 respectively, by this line (places a value of
* $0540 into the TICR register).
* 6. Be careful when using any of the BIT instructions (BCHG,
* BCLR, BSET, BTST), as they will only operate on a BYTE of
* memory, not a WORD. Thus to access a bit in the least
* significant half of a word sized register (B0-B7), "+1"
* must be added to the operand address. See the code
* segment example in item 5 above.
* 7. Because the equate files can generate many listing pages,
* the user may wish to disable the listing via NOLIST and
* LIST directives as seen in the above example code.
* 8. The latest version of this file is maintained on the
* Motorola FREEWARE Bulletin Board, 512/891-FREE (512/891-
* 3733). It operates continuously (except for maintenance)
* at 1200-2400 baud, 8-bits, no parity. Download the
* archive file 332EQU.ARC to get all the files.
*
****************************************************************************
****************************************************************************
* Initialize Channel Macro:
* Syntax: INIT_CH <channel#>,<fnct>,<HSRcode>,<HScode>,<priority>
*
* where: <channel#> is the channel number to be set.
* <fnct> is the function value for <channel#>.
* <HSRcode> is the host service request code for <channel#>.
* <HScode> is the host sequence code for <channel#>.
* <priority> is the priority code for <channel#>.
*
* Action:
* Initializes the specified channel for the specified function. This
* involves setting the appropriate channel fields in the CFSRn, HSRQn,
* HSRRn, and CPR registers without affecting any other register field.
* Preserves all An/Dn registers.
*
* Notes:
* 1. The registers are initialized in the following order as recommended
* in the TPU User's Manual: CFSRn, HSQRn, HSRRn, CPRn.
*
INIT_CH MACRO
SET_CF \1,\2
SET_XX \1,\3,HSQR
SET_XX \1,\4,HSRR
SET_XX \1,\5,CPR
ENDM
****************************************************************************
* Set Channel Function Macro:
* Syntax: SET_CF <channel#>,<value>
*
* where: <channel#> is the channel number to be set.
* <value> is the function value for <channel#>.
*
* Action:
* Sets the specified 4-bit channel number function field of the
* appropriate Channel Function Select Register (CFSR0, CFSR1, CFSR2,
* CFSR3) to the specified value without affecting any other CFSR field.
* Preserves all An/Dn registers.
*
SET_CF MACRO
OFFSET$ SET ((3-(\1/4))*2)+CFSR
SHFT$ SET (\1-((\1/4)*4))*4
MSK$ SET ((-($F<<SHFT$))-1)&$FFFF
MOVE.L D0,-(A7)
MOVE.W OFFSET$+REG$,D0
AND.W #MSK$,D0
OR.W #(\2&$F)<<SHFT$,D0
MOVE.W D0,OFFSET$+REG$
MOVE.L (A7)+,D0
ENDM
****************************************************************************
* Set 2-bit Channel Field Macro:
* Syntax: SET_XX <channel#>,<value>,<register>
*
* where: <channel#> is the channel number to be set.
* <value> is the function value for <channel#>.
* <register> is the register mneumonic for the register
* to be set (HSQR, HSRR, CPR).
*
* Action:
* Sets the specified 2-bit channel number field of the specified
* register to the specified value without affecting any other field.
* Preserves all An/Dn registers.
*
SET_XX MACRO
OFFSET$ SET ((1-(\1/8))*2)+\3
SHFT$ SET (\1-((\1/8)*8))*2
MSK$ SET ((-($3<<SHFT$))-1)&$FFFF
MOVE.L D0,-(A7)
MOVE.W OFFSET$+REG$,D0
AND.W #MSK$,D0
OR.W #(\2&$3)<<SHFT$,D0
MOVE.W D0,OFFSET$+REG$
MOVE.L (A7)+,D0
ENDM
****************************************************************************
* Wait for HSRR Channel Field to Become Ready Macro:
* Syntax: RDY_XX <channel#>
*
* where: <channel#> is the channel number to be checked.
*
* Action:
* Waits for the specified 2-bit channel number field of the Host
* Service Request Register (HSRR) to return to the ready state (No
* Host Service = 0) without affecting any other field.
* Preserves all An/Dn registers.
*
RDY_XX MACRO
OFFSET$ SET ((1-(\1/8))*2)+HSRR
SHFT$ SET (\1-((\1/8)*8))*2
MSK$ SET ((-($3<<SHFT$))-1)&$FFFF
MOVE.L D0,-(A7)
RDY\@ MOVE.W OFFSET$+REG$,D0
AND.W #MSK$,D0
BNE RDY\@
MOVE.L (A7)+,D0
ENDM
*********************************************************************
* Define Module Base Address
*********************************************************************
TPU$ EQU REG$+$E00 TPU base address
*********************************************************************
* Define Registers and Bits
*********************************************************************
TMCR EQU $000 TPU Module Configuration Register
DEF STOP,B15 . stop TPU clock
DEF TCR1P,B13,2 . TCR1 prescaler control (2 bits)
DEF TCR2P,B11,2 . TCR2 prescaler control (2 bits)
DEF EMU,B10 . emulation control
* NOTE: TCR1P, TCR2P, and EMU are WRITE-ONCE fields!
DEF T2CG,B9 . TCR2 clock/gate control
DEF STF,B8 . stop flag
DEF SUPV,B7 . supervisor data space
DEF PSCK,B6 . prescaler clock
DEF IARB,B0,4 . interrupt arbitration (4 bits)
*-- Prescaler Control Values --*
DIV1 EQU 0 Divide by 1
DIV2 EQU 1 Divide by 2
DIV4 EQU 2 Divide by 4
DIV8 EQU 3 Divide by 8
*-------------------------------------------------------------------*
TTCR EQU $002 TPU Test Configuration Register
* +-------------------- C A U T I O N ---------------------+
* | The bits here are for configuring and controlling the |
* | TPU module for testing purposes. General users |
* | should not alter the TTCR register! |
* +--------------------------------------------------------+
DEF INCAD,B12 . increment uPC address
DEF TCR1C,B11 . TCR clock source
DEF ACUTR,B9,2 . TPU response to ACUT line (2 bits)
DEF TSOSEL,B4,3 . TPU scan out selector (3 bits)
* NOTE: SOSEL bit field is different bit position from SIM's SIMTR!
DEF TSISEL,B1,3 . TPU scan in selector (3 bits)
DEF TMM,B0 . test memory map bit
*-------------------------------------------------------------------*
DSCR EQU $004 Development Support Control Register
DEF HOT4,B15 . halt on next T4 state
DEF BLC,B10 . branch latch control
DEF CLKS,B9 . stop TCR's during halt
DEF FRZ,B7,2 . IMB freeze response select (2 bits)
DEF CCL,B6 . channel condition latch
DEF BP,B5 . breakpoint: uPC match
DEF BC,B4 . breakpoint: channel register match
DEF BH,B3 . breakpoint: host service latch
DEF BL,B2 . breakpoint: link service latch
DEF BM,B1 . breakpoint: match recognition latch
DEF BT,B0 . breakpoint: transition detect latch
*-------------------------------------------------------------------*
DSSR EQU $006 Development Support Status Register
DEF BKPT,B7 . breakpoint assert flag
DEF PCBK,B6 . uPC match breakpoint flag
DEF CHBK,B5 . channel register breakpoint flag
DEF SRBK,B4 . service request breakpoint flag
DEF TPUF,B3 . TPU in freeze flag
*-------------------------------------------------------------------*
TICR EQU $008 TPU Interrupt Configuration Register
DEF TINTL,B8,3 . interrupt request level (3 bits)
DEF TINTV,B4,4 . channel interrupt base vector (4 bits)
* NOTE: Channel interrupt base vector is actually the upper nibble
* of the interrupt vector for the TPU. The lower nibble is
* supplied by the number of the interrupting channel, which
* creates a separate vector for each channel (block of 16
* vectors).
*-------------------------------------------------------------------*
CIER EQU $00A Channel Interrupt Enable Register
DEF CH15,B15 . channel 15
DEF CH14,B14 . channel 14
DEF CH13,B13 . channel 13
DEF CH12,B12 . channel 12
DEF CH11,B11 . channel 11
DEF CH10,B10 . channel 10
DEF CH9,B9 . channel 9
DEF CH8,B8 . channel 8
DEF CH7,B7 . channel 7
DEF CH6,B6 . channel 6
DEF CH5,B5 . channel 5
DEF CH4,B4 . channel 4
DEF CH3,B3 . channel 3
DEF CH2,B2 . channel 2
DEF CH1,B1 . channel 1
DEF CH0,B0 . channel 0
*-------------------------------------------------------------------*
CFSR0 EQU $00C Channel Function Select Register 0
CFSR1 EQU $00E Channel Function Select Register 1
CFSR2 EQU $010 Channel Function Select Register 2
CFSR3 EQU $012 Channel Function Select Register 3
CFSR EQU CFSR0 Channel Fnct. Select Reg's Base Address
*-- Channel Functions --*
F$DIO EQU $8 Descrete input/output
F$ITC EQU $A Input capture/input transition counter
F$OC EQU $E Output compare
F$PWM EQU $9 Pulse width modulation
F$PMA EQU $B Period measurement w/additional detection
F$PMM EQU F$PMA Period measurement w/missing detection
F$PSP EQU $C Position synchronized pulse generation
F$SM EQU $D Stepper motor
F$PPWA EQU $F Period/pulse-width accumulator
*-------------------------------------------------------------------*
HSQR0 EQU $014 Host Sequence Register 0
HSQR1 EQU $016 Host Sequence Register 1
HSQR EQU HSQR0 Host Sequence Registers Base Address
*-- Sequence codes (organized by channel function + period) --*
DIO.TRANS EQU 0 Transition mode
DIO.MATCH EQU 1 Match mode
DIO.PIN EQU 2 Record pin state
* NOTE: DIO sequence codes only used by DIO$INIT service request!
*
ITC.SNGL EQU 0 No link, single mode
ITC.CONT EQU 1 No link, continuous mode
ITC.LSNGL EQU 2 Link, single mode
ITC.LCONT EQU 3 Link, continuous mode
*
OC.XALL EQU 0 Execute all functions
OC.TCRN EQU 2 Only update TCRn parameters
*
PWM.NONE EQU 0 None
*
PMA.BANK EQU 0 PMA bank mode
PMA.COUNT EQU 1 PMA count mode
*
PMM.BANK EQU 2 PMM bank mode
PMM.COUNT EQU 3 PMM count mode
*
PSP.ANGLE EQU 0 Pulse width set by angle
PSP.TIME EQU 1 Pulse width set by time
*
SM.NONE EQU 0 None
*
PPWA.24PER EQU 0 24-bit period
PPWA.16PERL EQU 1 16-bit period + link
PPWA.24WID EQU 2 24-bit pulse width
PPWA.16WIDL EQU 3 16-bit pulse width + link
*-------------------------------------------------------------------*
HSRR0 EQU $018 Host Service Request Register 0
HSRR1 EQU $01A Host Service Request Register 1
HSRR EQU HSRR0 Host Service Request Registers Base Address
* +-------------------- C A U T I O N ---------------------+
* | Do not OR values into HSRRn, as another channel value |
* | could be changing due to TPU operation when the OR |
* | instruction performs its read-modify-write operation. |
* | Use a MOVE.W instruction instead to set values into |
* | HSRRn. |
* +--------------------------------------------------------+
*-- Service codes (organized by channel function + dollar sign) --*
DIO$NONE EQU 0 None
DIO$HIGH EQU 1 Force output high
DIO$LOW EQU 2 Force output low
DIO$INIT EQU 3 Initialization
*
ITC$NONE EQU 0 None
ITC$INIT EQU 1 Initialization
*
OC$NONE EQU 0 None
OC$HPULSE EQU 1 Host initiated pulse mode
OC$CPULSE EQU 3 Continuous pulse mode
*
PWM$NONE EQU 0 None
PWM$IMMED EQU 1 Immediate update request
PWM$INIT EQU 2 Initialization
*
PMA$NONE EQU 0 None
PMA$INIT EQU 1 Initialization
*
PMM$NONE EQU 0 None
PMM$INIT EQU 1 Initialization
*
PSP$NONE EQU 0 None
PSP$IMMED EQU 1 Immediate update request
PSP$INIT EQU 2 Initialization
PSP$FCHNG EQU 3 Force change
*
SM$NONE EQU 0 None
SM$INIT EQU 2 Initialization
SM$STEP EQU 3 Step request
*
PPWA$NONE EQU 0 None
PPWA$INIT EQU 2 Initialization
*-------------------------------------------------------------------*
CPR0 EQU $01C Channel Priority Register 0
CPR1 EQU $01E Channel Priority Register 1
CPR EQU CPR0 Channel Priority Registers Base Address
*-- Defined priorities --*
P$OFF EQU 0 No priority (Channel disabled)
P$LOW EQU 1 Low priority
P$MIDDLE EQU 2 Middle priority
P$HIGH EQU 3 High priority
*-------------------------------------------------------------------*
CISR EQU $020 Channel Interrupt Status Register
* NOTE: Uses CH15-CH0 as per Channel Interrupt Enable Register!
*-------------------------------------------------------------------*
LINK EQU $022 Link Register
* NOTE: Uses CH15-CH0 as per Channel Interrupt Enable Register!
*-------------------------------------------------------------------*
SGLR EQU $024 Service Grant Latch Register
* NOTE: Uses CH15-CH0 as per Channel Interrupt Enable Register!
*-------------------------------------------------------------------*
DCNR EQU $026 Decoded Channel Number Register
* NOTE: Uses CH15-CH0 as per Channel Interrupt Enable Register!
*-------------------------------------------------------------------*
*UNUSED EQU $028-$0FF Unused positions
*-------------------------------------------------------------------*
PRAM0.0 EQU $100 Parameter RAM for Channel 0, register 0
PRAM0.1 EQU $102 Parameter RAM for Channel 0, register 1
PRAM0.2 EQU $104 Parameter RAM for Channel 0, register 2
PRAM0.3 EQU $106 Parameter RAM for Channel 0, register 3
PRAM0.4 EQU $108 Parameter RAM for Channel 0, register 4
PRAM0.5 EQU $10A Parameter RAM for Channel 0, register 5
*UNUSED EQU $10C-$10F Unused positions
DEF TBS,B5,4 . time base selection
DEF PAC,B2,3 . pin action control
DEF PSC,B0,2 . pin state control
* NOTE: TBS, PAC, and PSC apply to each Parameter RAM register!
TBS.IC1M1 EQU %0000<<.TBS Input channel: capture TCR1, match TCR1
TBS.IC1M2 EQU %0001<<.TBS Input channel: capture TCR1, match TCR2
TBS.IC2M1 EQU %0010<<.TBS Input channel: capture TCR2, match TCR1
TBS.IC2M2 EQU %0011<<.TBS Input channel: capture TCR2, match TCR2
TBS.OC1M1 EQU %0100<<.TBS Output channel: capture TCR1, match TCR1
TBS.OC1M2 EQU %0101<<.TBS Output channel: capture TCR1, match TCR2
TBS.OC2M1 EQU %0110<<.TBS Output channel: capture TCR2, match TCR1
TBS.OC2M2 EQU %0111<<.TBS Output channel: capture TCR2, match TCR2
TBS.NCHNG EQU %1111<<.TBS No change
*
PAC.IGNORE EQU %000<<.PAC Ignore (do not detect transition)
PAC.RISE EQU %001<<.PAC Detect rising edge
PAC.FALL EQU %010<<.PAC Detect falling edge
PAC.EITHER EQU %011<<.PAC Detect either edge
PAC.NCHNG EQU %111<<.PAC Do not change PAC
*
PSC.SET EQU %00<<.PSC Force pin as specified by PAC latches
PSC.HIGH EQU %01<<.PSC Force pin high
PSC.LOW EQU %10<<.PSC Force pin low
PSC.NONE EQU %11<<.PSC Do not force any state
*-------------------------------------------------------------------*
PRAM1.0 EQU $110 Parameter RAM for Channel 1, register 0
PRAM1.1 EQU $112 Parameter RAM for Channel 1, register 1
PRAM1.2 EQU $114 Parameter RAM for Channel 1, register 2
PRAM1.3 EQU $116 Parameter RAM for Channel 1, register 3
PRAM1.4 EQU $118 Parameter RAM for Channel 1, register 4
PRAM1.5 EQU $11A Parameter RAM for Channel 1, register 5
*UNUSED EQU $11C-$11F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM2.0 EQU $120 Parameter RAM for Channel 2, register 0
PRAM2.1 EQU $122 Parameter RAM for Channel 2, register 1
PRAM2.2 EQU $124 Parameter RAM for Channel 2, register 2
PRAM2.3 EQU $126 Parameter RAM for Channel 2, register 3
PRAM2.4 EQU $128 Parameter RAM for Channel 2, register 4
PRAM2.5 EQU $12A Parameter RAM for Channel 2, register 5
*UNUSED EQU $12C-$12F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM3.0 EQU $130 Parameter RAM for Channel 3, register 0
PRAM3.1 EQU $132 Parameter RAM for Channel 3, register 1
PRAM3.2 EQU $134 Parameter RAM for Channel 3, register 2
PRAM3.3 EQU $136 Parameter RAM for Channel 3, register 3
PRAM3.4 EQU $138 Parameter RAM for Channel 3, register 4
PRAM3.5 EQU $13A Parameter RAM for Channel 3, register 5
*UNUSED EQU $13C-$13F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM4.0 EQU $140 Parameter RAM for Channel 4, register 0
PRAM4.1 EQU $142 Parameter RAM for Channel 4, register 1
PRAM4.2 EQU $144 Parameter RAM for Channel 4, register 2
PRAM4.3 EQU $146 Parameter RAM for Channel 4, register 3
PRAM4.4 EQU $148 Parameter RAM for Channel 4, register 4
PRAM4.5 EQU $14A Parameter RAM for Channel 4, register 5
*UNUSED EQU $14C-$14F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM5.0 EQU $150 Parameter RAM for Channel 5, register 0
PRAM5.1 EQU $152 Parameter RAM for Channel 5, register 1
PRAM5.2 EQU $154 Parameter RAM for Channel 5, register 2
PRAM5.3 EQU $156 Parameter RAM for Channel 5, register 3
PRAM5.4 EQU $158 Parameter RAM for Channel 5, register 4
PRAM5.5 EQU $15A Parameter RAM for Channel 5, register 5
*UNUSED EQU $15C-$15F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM6.0 EQU $160 Parameter RAM for Channel 6, register 0
PRAM6.1 EQU $162 Parameter RAM for Channel 6, register 1
PRAM6.2 EQU $164 Parameter RAM for Channel 6, register 2
PRAM6.3 EQU $166 Parameter RAM for Channel 6, register 3
PRAM6.4 EQU $168 Parameter RAM for Channel 6, register 4
PRAM6.5 EQU $16A Parameter RAM for Channel 6, register 5
*UNUSED EQU $16C-$16F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM7.0 EQU $170 Parameter RAM for Channel 7, register 0
PRAM7.1 EQU $172 Parameter RAM for Channel 7, register 1
PRAM7.2 EQU $174 Parameter RAM for Channel 7, register 2
PRAM7.3 EQU $176 Parameter RAM for Channel 7, register 3
PRAM7.4 EQU $178 Parameter RAM for Channel 7, register 4
PRAM7.5 EQU $17A Parameter RAM for Channel 7, register 5
*UNUSED EQU $17C-$17F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM8.0 EQU $180 Parameter RAM for Channel 8, register 0
PRAM8.1 EQU $182 Parameter RAM for Channel 8, register 1
PRAM8.2 EQU $184 Parameter RAM for Channel 8, register 2
PRAM8.3 EQU $186 Parameter RAM for Channel 8, register 3
PRAM8.4 EQU $188 Parameter RAM for Channel 8, register 4
PRAM8.5 EQU $18A Parameter RAM for Channel 8, register 5
*UNUSED EQU $18C-$18F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM9.0 EQU $190 Parameter RAM for Channel 9, register 0
PRAM9.1 EQU $192 Parameter RAM for Channel 9, register 1
PRAM9.2 EQU $194 Parameter RAM for Channel 9, register 2
PRAM9.3 EQU $196 Parameter RAM for Channel 9, register 3
PRAM9.4 EQU $198 Parameter RAM for Channel 9, register 4
PRAM9.5 EQU $19A Parameter RAM for Channel 9, register 5
*UNUSED EQU $19C-$19F Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM10.0 EQU $1A0 Parameter RAM for Channel 10, register 0
PRAM10.1 EQU $1A2 Parameter RAM for Channel 10, register 1
PRAM10.2 EQU $1A4 Parameter RAM for Channel 10, register 2
PRAM10.3 EQU $1A6 Parameter RAM for Channel 10, register 3
PRAM10.4 EQU $1A8 Parameter RAM for Channel 10, register 4
PRAM10.5 EQU $1AA Parameter RAM for Channel 10, register 5
*UNUSED EQU $1AC-$1AF Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM11.0 EQU $1B0 Parameter RAM for Channel 11, register 0
PRAM11.1 EQU $1B2 Parameter RAM for Channel 11, register 1
PRAM11.2 EQU $1B4 Parameter RAM for Channel 11, register 2
PRAM11.3 EQU $1B6 Parameter RAM for Channel 11, register 3
PRAM11.4 EQU $1B8 Parameter RAM for Channel 11, register 4
PRAM11.5 EQU $1BA Parameter RAM for Channel 11, register 5
*UNUSED EQU $1BC-$1BF Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM12.0 EQU $1C0 Parameter RAM for Channel 12, register 0
PRAM12.1 EQU $1C2 Parameter RAM for Channel 12, register 1
PRAM12.2 EQU $1C4 Parameter RAM for Channel 12, register 2
PRAM12.3 EQU $1C6 Parameter RAM for Channel 12, register 3
PRAM12.4 EQU $1C8 Parameter RAM for Channel 12, register 4
PRAM12.5 EQU $1CA Parameter RAM for Channel 12, register 5
*UNUSED EQU $1CC-$1CF Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM13.0 EQU $1D0 Parameter RAM for Channel 13, register 0
PRAM13.1 EQU $1D2 Parameter RAM for Channel 13, register 1
PRAM13.2 EQU $1D4 Parameter RAM for Channel 13, register 2
PRAM13.3 EQU $1D6 Parameter RAM for Channel 13, register 3
PRAM13.4 EQU $1D8 Parameter RAM for Channel 13, register 4
PRAM13.5 EQU $1DA Parameter RAM for Channel 13, register 5
*UNUSED EQU $1DC-$1DF Unused positions
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM14.0 EQU $1E0 Parameter RAM for Channel 14, register 0
PRAM14.1 EQU $1E2 Parameter RAM for Channel 14, register 1
PRAM14.2 EQU $1E4 Parameter RAM for Channel 14, register 2
PRAM14.3 EQU $1E6 Parameter RAM for Channel 14, register 3
PRAM14.4 EQU $1E8 Parameter RAM for Channel 14, register 4
PRAM14.5 EQU $1EA Parameter RAM for Channel 14, register 5
PRAM14.6 EQU $1EC Parameter RAM for Channel 14, register 6
PRAM14.7 EQU $1EE Parameter RAM for Channel 14, register 7
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*-------------------------------------------------------------------*
PRAM15.0 EQU $1F0 Parameter RAM for Channel 15, register 0
PRAM15.1 EQU $1F2 Parameter RAM for Channel 15, register 1
PRAM15.2 EQU $1F4 Parameter RAM for Channel 15, register 2
PRAM15.3 EQU $1F6 Parameter RAM for Channel 15, register 3
PRAM15.4 EQU $1F8 Parameter RAM for Channel 15, register 4
PRAM15.5 EQU $1FA Parameter RAM for Channel 15, register 5
PRAM15.6 EQU $1FC Parameter RAM for Channel 15, register 6
PRAM15.7 EQU $1FE Parameter RAM for Channel 15, register 7
* NOTE: Uses TBS, PAC, and PSC as per Parameter RAM for Channel 0
*********************************************************************
IFNE 0 ------- don't assemble sample macro usage code --------
* SAMPLE MACRO USAGE CODE:
* - Each line that follows is an independent example!
INIT_CH .CH15,F$OC,OC$HPULSE,OC.XALL,P$OFF
INIT_CH .CH14,F$DIO,DIO$HIGH,DIO.TRANS,P$LOW
INIT_CH .CH13,F$DIO,DIO$LOW,DIO.PIN,P$MIDDLE
INIT_CH .CH12,F$ITC,ITC$INIT,ITC.LSNGL,P$HIGH
INIT_CH .CH11,F$PMA,PMA$INIT,PMA.COUNT,P$OFF
INIT_CH .CH10,F$PMM,PMM$INIT,PMM.COUNT,P$LOW
INIT_CH .CH9,F$PSP,PSP$FCHNG,PSP.TIME,P$MIDDLE
INIT_CH .CH8,F$SM,SM$NONE,SM.NONE,P$HIGH
INIT_CH .CH7,F$SM,SM$INIT,SM.NONE,P$OFF
INIT_CH .CH6,F$SM,SM$STEP,SM.NONE,P$LOW
INIT_CH .CH5,F$PPWA,PPWA$INIT,PPWA.24PER,P$MIDDLE
INIT_CH .CH4,F$PPWA,PPWA$NONE,PPWA.16PERL,P$HIGH
INIT_CH .CH3,F$PPWA,PPWA$NONE,PPWA.24WID,P$OFF
SET_CF .CH15,1
SET_CF .CH14,2
SET_CF .CH13,3
SET_CF .CH12,4
SET_CF .CH11,5
SET_CF .CH10,6
SET_CF .CH9,7
SET_CF .CH8,8
SET_CF .CH7,9
SET_CF .CH6,$A
SET_CF .CH5,$B
SET_CF .CH4,$C
SET_CF .CH3,$D
SET_CF .CH2,$E
SET_CF .CH1,$F
SET_CF .CH0,$1F
SET_XX .CH15,1,HSQR
SET_XX .CH14,2,HSQR
SET_XX .CH13,3,HSQR
SET_XX .CH12,5,HSQR
SET_XX .CH11,1,HSQR
SET_XX .CH10,1,HSQR
SET_XX .CH9,1,HSQR
SET_XX .CH8,1,HSQR
SET_XX .CH7,1,HSQR
SET_XX .CH6,1,HSQR
SET_XX .CH5,1,HSQR
SET_XX .CH4,1,HSQR
SET_XX .CH3,1,HSQR
SET_XX .CH2,1,HSQR
SET_XX .CH1,1,HSQR
SET_XX .CH0,1,HSQR
* - The lines that follow are a complete code segment example to set
* up channel 7 for the Descrete Input/Output (DIO) function as
* described in the TPU User's Manual. Equates have been added
* to illustrate advanced TPU programming techniques.
*
SFREQ EQU 16777216 System clock frequency (in Hz)
* NOTE: The SYNCR register also depends on SFREQ!
TPU_ARB EQU 7 Arbitration level for TPU
TPU_ILVL EQU 5 Interrupt level for TPU
TPU_VNBR EQU 64 Interrupt vector number for TPU
* NOTE: TPU_VNBR must be modulo 16, as TPU uses 1 vector per channel.
DIV1X EQU DIV2 Divide value for TCR1P_
DIV2X EQU DIV2 Divide value for TCR2P_
*
* PSCK bit value for use in TMCR register (comment out the one not to use!):
_PSCKBIT EQU 0
*_PSCKBIT EQU PSCK_
IFEQ _PSCKBIT
PSCKVAL EQU 32 System clock divide value = 32
ENDC
IFNE _PSCKBIT
PSCKVAL EQU 4 System clock divide value = 4
ENDC
*
* T2CG bit value for use in TMCR register (comment out the one not to use!):
* - T2CG (TCR2) not required for this example, but is included here
* for completeness.
_T2CGBIT EQU 0
*_T2CGBIT EQU T2CG_
IFEQ _T2CGBIT
T2CGVAL EQU 1 External clock divide value = 1
ENDC
IFNE _T2CGBIT
T2CGVAL EQU 8 System clock divide value = 8
ENDC
*
TCR1_DIV EQU (1<<DIV1X)*PSCKVAL TCR1 frequency divide value
TCR1FREQ EQU SFREQ/TCR1_DIV TCR1 frequncy (in Hz)
*
TCR2_DIV EQU (1<<DIV2X)*T2CGVAL TCR2 frequency divide value
TCR2FREQ EQU SFREQ/TCR2_DIV TCR2 frequncy (in Hz)
*
PINLVL_INIT EQU 0 Initial value for PIN_LEVEL param.
*-- Initialize channel 7 ---------------------------------------------------
*
* Init. Module Configuration register:
* - set TCR1 prescaler
* - set TCR2 prescaler (Don't Care)
* - set supervisor data space
* - set PSCK and T2CG bits
* - set interrupt arbitration
*
TMCRVAL SET DIV1X*TCR1P_+DIV2X*TCR2P_+_SUPV
TMCRVAL SET TMCRVAL+_PSCKBIT+_T2CGBIT+TPU_ARB*IARB_
MOVE.W #TMCRVAL,TMCR+TPU$
* Init. Interrupt Configuration Register:
* - set interrupt level
* - set channel interrupt base vector
*
MOVE.W #TPU_ILVL*TINTL_+(TPU_VNBR>>4)*TINTV_,TICR+TPU$
* Init. Channel Interrupt Enable Register:
*
OR.W #_CH7,CIER+TPU$ . (OR doesn't affect other channels!)
* Initialize parameter ram (3 words):
* - set CHANNEL_CONTROL
* - set PIN_LEVEL to a known initial state value (optional)
* - set MATCH_RATE parameter = 15/10000 = 1.5 msec
*
MOVE.W #TBS.IC1M1+PAC.IGNORE+PSC.NONE,PRAM7.0+TPU$
MOVE.W #PINLVL_INIT,PRAM7.1+TPU$
MOVE.W #(15*TCR1FREQ)/10000,PRAM7.2+TPU$
* Initialize channel 7 for DIO "match rate" (periodic) operation:
*
INIT_CH .CH7,F$DIO,DIO$INIT,DIO.MATCH,P$MIDDLE
* Wait for channel 7 to become ready (or wait for interrupt!):
*
RDY_XX .CH7
*
*-- Done with channel 7 ----------------------------------------------------
* Start next channel or coding function!
ENDC